from django.contrib import admin

# Register your models here.
from .models import  Book,Author
class BookManager(admin.ModelAdmin):
    #1显示哪些列
    list_display = ['id','title','pub','price']
    #2点击哪些可以进入修改页
    list_display_links = ['title']
    #过滤器
    list_filter = ['pub']
    #搜索框
    search_fields = ['title']
    #添加可在列表页编辑的字段，注意和2互斥
    list_editable = ['price']

class AuthorManager(admin.ModelAdmin):
    list_display = ['id','name','age']


admin.site.register(Book,BookManager)
admin.site.register(Author,AuthorManager)